package com.winder;

import android.support.annotation.Nullable;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;

/**
 * Created by ilkkzm on 17-9-20.
 */

public class PassEvent {
    public static ReactContext myContext;
    public void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) {
        reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
                .emit(eventName,params);
    }
    public void invokeEvent(String s) {
        WritableMap et= Arguments.createMap();
        et.putString("value", s);
        sendEvent(myContext, "ScanCode", et);
    }
}
